package com.jia.leetCode;

/**
 * 1446. 连续字符
 *
 *
 */
public class Pro1446 {
    public int maxPower(String s) {
        int max = 1;
        int count = 1;
        char pre = ' ';
        for(int i = 0; i < s.length(); i++) {
            if(i == 0) {
                pre = s.charAt(i);
            }else {
                if(s.charAt(i) == pre) {
                    ++count;
                }else {
                    max = Math.max(max, count);
                    pre = s.charAt(i);
                    count = 1;
                }
            }
        }
        return Math.max(max, count);
    }
}
